package com.amigo.online.provider.adv.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.amigo.online.provider.adv.entity.AdvTantanClickRecord;
import com.amigo.online.provider.adv.mapper.AdvTantanClickRecordMapper;
import com.amigo.online.provider.adv.service.AdvTantanClickRecordService;

@Service
public class AdvTantanClickRecordServiceImpl implements AdvTantanClickRecordService {

    @Autowired
    AdvTantanClickRecordMapper advTantanClickRecordMapper;

    @Override
    @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class) //事物传播机制，当前子事物不影响主事物
    public void recordTantanAdvClicked(Long advId, String device, Long userId) {
        AdvTantanClickRecord record = new AdvTantanClickRecord(advId, userId, device);
        //记录数据
        advTantanClickRecordMapper.insert(record);
    }

}
